package com.e9where.canpoint.customrecycler.recycler;

import android.support.v7.widget.GridLayoutManager;

import com.e9where.canpoint.customrecycler.recycler.adapter.CustomAdapter;

/**
 * Created by Administrator on 2017/12/4.
 */

public class CustomSapnSizeLookUp extends GridLayoutManager.SpanSizeLookup {

    private CustomAdapter customAdapter;
    private int mSpanSize;

    public CustomSapnSizeLookUp(CustomAdapter adapter, int spanSize){
        this.customAdapter = adapter;
        this.mSpanSize = spanSize;
    }


    @Override
    public int getSpanSize(int position) {
        boolean isHeaderOrFooter = customAdapter.isHeader(position) || customAdapter.isFooter(position);
        return isHeaderOrFooter ? mSpanSize : 1;
    }
}

